<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* body {
            perspective: 300px;
            perspective-origin: center -300px;
        } */

        .box1 {
            width: 100px;
            height: 150px;
            background-color: red;
            transform: rotateY(45deg);
            transform-origin: right;
            float: left;
        }

        .box2 {
            width: 100px;
            height: 150px;
            background-color: pink;
            transform: rotateY(-45deg);
            transform-origin: left;
            float: left;
        }

        .center {
            position: absolute;
            top: 300px;
            left: 50%;
            transform: translateX(-50%);
            /* 上帝视角必须在3d变换的父元素上 */
            perspective: 300px;
            perspective-origin: center 300px;
        }

    </style>
</head>
<body>
    <div class="center">
        <div class="box1"></div>
        <div class="box2"></div>
    </div>
</body>
</html>